import { createApp } from "vue";
import Toast from "@/components/common/Toast.vue";
export default function (
  msg = "",
  msgType = "default",
  delay = 0,
  duration = 1000
) {
  if (!msg) return;
  const toast = createApp(Toast, { msg, msgType });
  const fragment: any = document.createDocumentFragment();
  setTimeout(() => {
    toast.mount(fragment);
    document.body.appendChild(fragment);
    setTimeout(() => {
      toast.unmount();
    }, duration);
  }, delay);
}
